package cn.com.fattiger.framework.cms.admin.common.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 
 * @author fattiger.xiaoyang
 * @date   2016/06/07
 */
@Entity
@Table(name = "wj_questionnaire")
public class Questionnaire {
    @Id
	@GeneratedValue
    private Long id ;						// 问卷主键，标识一套问卷
    private String title ;					// 调查问卷标题
    private String discribe ;				// 问卷规则说明（注意特殊符号处理）
    private java.util.Date createtime ;		// 创建时间
    private Long state ;					// 状态（1：可用 2：停用 ）
    private String anonymous ;				// 是否匿名
    private String remark ;					// 备注说明
    
    @OneToMany(cascade = {CascadeType.PERSIST,CascadeType.REFRESH})
    @JoinColumn(name = "questionnaireId")
    @OrderBy(value="sequence")
    private List<Question> questions = new ArrayList<Question>();
    
    public Long getId (){
        return this.id ;
    }
    public void setId (Long id){
        this.id = id ;
    }
    
    public String getTitle (){
        return this.title ;
    }
    public void setTitle (String title){
        this.title = title ;
    }
    
    public String getDiscribe (){
        return this.discribe ;
    }
    public void setDiscribe (String discribe){
        this.discribe = discribe ;
    }
    @Temporal(TemporalType.TIMESTAMP)
    public java.util.Date getCreatetime (){
        return this.createtime ;
    }
    public void setCreatetime (java.util.Date createtime){
        this.createtime = createtime ;
    }
    
    public Long getState (){
        return this.state ;
    }
    public void setState (Long state){
        this.state = state ;
    }
    
    public String getAnonymous (){
        return this.anonymous ;
    }
    public void setAnonymous (String anonymous){
        this.anonymous = anonymous ;
    }
    
    public String getRemark (){
        return this.remark ;
    }
    public void setRemark (String remark){
        this.remark = remark ;
    }
	public List<Question> getQuestions() {
		return questions;
	}
	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}
}